package riceSystem.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import riceSystem.dao.DaoTemplateInterface;
import riceSystem.entity.City;
import riceSystem.exception.RunException;
import riceSystem.service.ServiceTemplateInterface;
@Component("cityService")
public class CityServiceImpl implements ServiceTemplateInterface<City> {
	
	private DaoTemplateInterface<City> cityDao;
	
	public DaoTemplateInterface<City> getCityDao() {
		return cityDao;
	}
	@Resource(name="cityDao")
	public void setCityDao(DaoTemplateInterface<City> cityDao) {
		this.cityDao = cityDao;
	}

	public void add(City t) throws RunException {
		cityDao.save(t);
	}

	public void removeById(long id) throws RunException {
		cityDao.deleteById(id);
	}

	public void remove(City t) throws RunException {
		cityDao.delete(t);
	}

	public long update(City t) throws RunException {
		return cityDao.update(t);
	}

	public City getById(long id) throws RunException {
		return cityDao.loadById(id);
	}

	public List<City> getAll() throws RunException {
		return cityDao.loadAll();
	}
}
